﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

namespace Lib_Automation
{
    public class CutScreen
    {
        public static Bitmap Cut()
        {
            Rectangle r = Screen.PrimaryScreen.Bounds;

            Bitmap b1 = new Bitmap(Convert.ToInt32(r.Width), Convert.ToInt32(r.Height));
            Graphics g = Graphics.FromImage(b1);
            g.CopyFromScreen(Convert.ToInt32(r.X), Convert.ToInt32(r.Y), 0, 0, new Size(b1.Width, b1.Height));
            return b1;
        }

        public static Bitmap Cut(System.Windows.Rect r)
        {
            Bitmap b1 = new Bitmap(Convert.ToInt32(r.Width), Convert.ToInt32(r.Height));
            Graphics g = Graphics.FromImage(b1);
            g.CopyFromScreen(Convert.ToInt32(r.X), Convert.ToInt32(r.Y),0 ,0,new Size(b1.Width, b1.Height));
           return b1;

        }

    }
}
